home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-03 | 3.4 KB | 200 lines | [TEXT/MMCC] |
- // CMainWindow.cp -- window methods
- // Created 01/01/95 12:01 PM by AppMaker
-
- #include "CMainWindow.h"
-
- #include "CAdd.h"
-
- #include "CAMReminderData.h"
- #include <UReanimator.h>
- #include <LStream.h>
- #include <LListBox.h>
- #include <LStdControl.h>
-
- #define PPob_MainWindowID 200
- #define RidL_MainWindowID 200
-
- //----------
- CMainWindow*
- CMainWindow::CreateMainWindow(
- LCommander *inSuperCommander,
- CAMReminderData *inData)
- {
- CMainWindow *window;
-
- window = (CMainWindow *)LWindow::CreateWindow(PPob_MainWindowID, inSuperCommander);
- window->mData = inData;
-
- return window;
- }
-
- //----------
- // This is the function you register with URegistrar to create a
- // CMainWindow from a resource
-
- CMainWindow*
- CMainWindow::CreateMainWindowStream(
- LStream *inStream)
- {
- return (new CMainWindow(inStream));
- }
-
- //----------
- CMainWindow::CMainWindow()
- {
- }
-
- //----------
- CMainWindow::CMainWindow(
- LStream *inStream)
- : LWindow(inStream)
- {
- }
-
- //----------
- CMainWindow::~CMainWindow()
- {
- }
-
- //----------
- // This member function gets called once the containment hierarchy that contains
- // this pane has been built. It gives us a chance to get data members for
- // interesting subviews, and to do other operations now that our subviews exist.
- void
- CMainWindow::FinishCreateSelf()
- {
- mRemindersList = (LListBox *)FindPaneByID('Remi');
- mAddButton = (LStdButton *)FindPaneByID('Add ');
- mEditButton = (LStdButton *)FindPaneByID('Edit');
- mDeleteButton = (LStdButton *)FindPaneByID('Dele');
-
- UReanimator::LinkListenerToControls(this, this, RidL_MainWindowID);
- // the purpose is to "connect" self to whatever controls
- // that we want to "listen" to
-
- // any additional initialization for your window:
-
- }
-
- //----------
- void
- CMainWindow::DoAddReminder()
- {
- CAdd::CreateAdd(this);
- }
-
- //----------
- void
- CMainWindow::DoEditReminder()
- {
- CAdd::CreateAdd(this);
- }
-
- //----------
- void
- CMainWindow::DoDeleteReminder()
- {
-
- }
-
- //----------
- void
- CMainWindow::ListenToMessage(
- MessageT inMessage,
- void *ioParam)
- {
- switch (inMessage) {
- case 'Addr':
- DoAddReminder();
- break;
-
- case 'Edir':
- DoEditReminder();
- break;
-
- case 'Delr':
- DoDeleteReminder();
- break;
-
- default:
- break;
- }
- }
-
- //----------
- void
- CMainWindow::ObeyAdd (CAdd *dialog)
- {
- // get values from dialog; do something with them
-
- delete dialog;
- }
-
- //----------
- Boolean
- CMainWindow::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
- // Remember to add same cases to FindCommandStatus below
- // to enable/disable the commands
-
- case cmd_Add:
- ObeyAdd ((CAdd *)ioParam);
- break;
-
- default:
- cmdHandled = LWindow::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- //----------
- void
- CMainWindow::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
-
- default:
- LWindow::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-
- //----------
- Boolean
- CMainWindow::FocusDraw()
- {
- Boolean focused = LView::FocusDraw();
-
- if (focused) {
- AuxWinHandle awHndl;
- CTabHandle awCTable;
- ColorSpec contentSpec;
-
- GetAuxWin(GetMacPort(), &awHndl);
- awCTable = (**awHndl).awCTable;
- contentSpec = (**awCTable).ctTable [wContentColor]; // should search vs. index
- ::RGBBackColor(&contentSpec.rgb);
- }
-
- return focused;
- }
-